package com.xin.di.uav.applet.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xin.di.uav.applet.po.PricingRuleRange;
import com.xin.di.uav.applet.service.IPricingRuleRangeService;
import com.xin.di.uav.common.request.pricing.PricingAddRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 定价规则范围明细表 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-11-14
 */
@Controller
public class PricingRuleRangeRest {
    @Autowired
    private IPricingRuleRangeService iPricingRuleRangeService;

    public void add(PricingAddRequest pricingAddRequest) {
        iPricingRuleRangeService.add(pricingAddRequest);
    }

    public List<PricingRuleRange> getPricingRuleRangeByIds(List<String> ids) {
        return iPricingRuleRangeService.list(new QueryWrapper<PricingRuleRange>().in("pricing_rule_id", ids));
    }

    public void updatePricingRuleRangeDemo(PricingRuleRange pricingRuleRange) {
        iPricingRuleRangeService.updateById(pricingRuleRange);
    }

    public void insertRuleRangeDemo(PricingRuleRange pricingRuleRange) {
        iPricingRuleRangeService.save(pricingRuleRange);
    }

    public void delRuleRangeDemo(List<String> ids) {
        iPricingRuleRangeService.removeBatchByIds(ids);
    }

    public void delRuleRangeByPricingRuleIds(List<String> ids) {
        iPricingRuleRangeService.remove(new QueryWrapper<PricingRuleRange>().in("pricing_rule_id", ids));
    }
}
